<?php
/**最新咨询列表*/
namespace App\Http\Controllers;

use App\Http\Models\User;
use Illuminate\Support\Facades\DB;

class NewsController extends Controller
{
    public function __construct()
    {
        $this->nav = '最新咨询';
    }

    public function index()
    {
        $param = array();
        if(!session('user')){
            $this->user = '';
        }else{
            $this->user = User::find(session('user')->id);
            $param['cart'] = CommonController::shopcart(session('user')->id);
        }
        $param['news_list'] = DB::table('information')
            ->where('information_status',1)
            ->orderBy('information_desc','desc')
            ->paginate('4');

        return view('news',['user'=>$this->user,'param'=>$param,'nav'=>$this->nav]);
    }
}
